home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / lib / mozilla-firefox / include / content / nsIFormControl.h < prev    next >
C/C++ Source or Header  |  2006-05-08  |  5KB  |  147 lines

  1. /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /* ***** BEGIN LICENSE BLOCK *****
  3.  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  4.  *
  5.  * The contents of this file are subject to the Mozilla Public License Version
  6.  * 1.1 (the "License"); you may not use this file except in compliance with
  7.  * the License. You may obtain a copy of the License at
  8.  * http://www.mozilla.org/MPL/
  9.  *
  10.  * Software distributed under the License is distributed on an "AS IS" basis,
  11.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  12.  * for the specific language governing rights and limitations under the
  13.  * License.
  14.  *
  15.  * The Original Code is mozilla.org code.
  16.  *
  17.  * The Initial Developer of the Original Code is
  18.  * Netscape Communications Corporation.
  19.  * Portions created by the Initial Developer are Copyright (C) 1998
  20.  * the Initial Developer. All Rights Reserved.
  21.  *
  22.  * Contributor(s):
  23.  *
  24.  * Alternatively, the contents of this file may be used under the terms of
  25.  * either of the GNU General Public License Version 2 or later (the "GPL"),
  26.  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  27.  * in which case the provisions of the GPL or the LGPL are applicable instead
  28.  * of those above. If you wish to allow use of your version of this file only
  29.  * under the terms of either the GPL or the LGPL, and not to allow others to
  30.  * use your version of this file under the terms of the MPL, indicate your
  31.  * decision by deleting the provisions above and replace them with the notice
  32.  * and other provisions required by the GPL or the LGPL. If you do not delete
  33.  * the provisions above, a recipient may use your version of this file under
  34.  * the terms of any one of the MPL, the GPL or the LGPL.
  35.  *
  36.  * ***** END LICENSE BLOCK ***** */
  37. #ifndef nsIFormControl_h___
  38. #define nsIFormControl_h___
  39.  
  40. #include "nsISupports.h"
  41. class nsIDOMHTMLFormElement;
  42. class nsPresContext;
  43. class nsPresState;
  44. class nsIContent;
  45. class nsString;
  46. class nsIFormProcessor;
  47. class nsIFormSubmission;
  48.  
  49. #define NS_FORM_BUTTON_BUTTON   1
  50. #define NS_FORM_BUTTON_RESET    2
  51. #define NS_FORM_BUTTON_SUBMIT   3
  52. #define NS_FORM_FIELDSET        4
  53. #define NS_FORM_INPUT_BUTTON    5
  54. #define NS_FORM_INPUT_CHECKBOX  6
  55. #define NS_FORM_INPUT_FILE      7
  56. #define NS_FORM_INPUT_HIDDEN    8
  57. #define NS_FORM_INPUT_RESET     9
  58. #define NS_FORM_INPUT_IMAGE    10
  59. #define NS_FORM_INPUT_PASSWORD 11
  60. #define NS_FORM_INPUT_RADIO    12
  61. #define NS_FORM_INPUT_SUBMIT   13
  62. #define NS_FORM_INPUT_TEXT     14
  63. #define NS_FORM_LABEL          15
  64. #define NS_FORM_OPTION         16
  65. #define NS_FORM_OPTGROUP       17
  66. #define NS_FORM_LEGEND         18
  67. #define NS_FORM_SELECT         19
  68. #define NS_FORM_TEXTAREA       20
  69. #define NS_FORM_OBJECT         21
  70.  
  71. #define NS_IFORMCONTROL_IID   \
  72. { 0xfcf27549, 0xbd77, 0x455a, \
  73.   {0x8c, 0x3e, 0xbb, 0x20, 0xc5, 0xaf, 0x7b, 0x86} }
  74.  
  75.  
  76. /**
  77.  * Interface which all form controls (e.g. buttons, checkboxes, text,
  78.  * radio buttons, select, etc) implement in addition to their dom specific
  79.  * interface.
  80.  */
  81. class nsIFormControl : public nsISupports
  82. {
  83. public:
  84.  
  85.   NS_DEFINE_STATIC_IID_ACCESSOR(NS_IFORMCONTROL_IID)
  86.  
  87.   /**
  88.    * Get the form for this form control.
  89.    * @param aForm the form [OUT]
  90.    */
  91.   NS_IMETHOD GetForm(nsIDOMHTMLFormElement** aForm) = 0;
  92.  
  93.   /**
  94.    * Set the form for this form control.
  95.    * @param aForm the form
  96.    * @param aRemoveFromForm set false if you do not want this element removed
  97.    *        from the form.  (Used by nsFormControlList::Clear())
  98.    */
  99.   NS_IMETHOD SetForm(nsIDOMHTMLFormElement* aForm,
  100.                      PRBool aRemoveFromForm = PR_TRUE) = 0;
  101.  
  102.   /**
  103.    * Get the type of this control as an int (see NS_FORM_* above)
  104.    * @return the type of this control
  105.    */
  106.   NS_IMETHOD_(PRInt32) GetType() const = 0 ;
  107.  
  108.   /**
  109.    * Reset this form control (as it should be when the user clicks the Reset
  110.    * button)
  111.    */
  112.   NS_IMETHOD Reset() = 0;
  113.  
  114.   /**
  115.    * Tells the form control to submit its names and values to the form
  116.    * submission object
  117.    * @param aFormSubmission the form submission to notify of names/values/files
  118.    *                       to submit
  119.    * @param aSubmitElement the element that was pressed to submit (possibly
  120.    *                       null)
  121.    */
  122.   NS_IMETHOD SubmitNamesValues(nsIFormSubmission* aFormSubmission,
  123.                                nsIContent* aSubmitElement) = 0;
  124.  
  125.   /**
  126.    * Save to presentation state.  The form control will determine whether it
  127.    * has anything to save and if so, create an entry in the layout history for
  128.    * its pres context.
  129.    */
  130.   NS_IMETHOD SaveState() = 0;
  131.  
  132.   /**
  133.    * Restore from presentation state.  You pass in the presentation state for
  134.    * this form control (generated with GenerateStateKey() + "-C") and the form
  135.    * control will grab its state from there.
  136.    *
  137.    * @param aState the pres state to use to restore the control
  138.    * @return PR_TRUE if the form control was a checkbox and its
  139.    *         checked state was restored, PR_FALSE otherwise.
  140.    */
  141.   virtual PRBool RestoreState(nsPresState* aState) = 0;
  142.  
  143.   virtual PRBool AllowDrop() = 0;
  144. };
  145.  
  146. #endif /* nsIFormControl_h___ */
  147.